<?php
if (!isset($_SESSION)) {
  session_start();
}
//購買動作處理購買數量總價格等信息
include("common.inc.php");
InitGP(array("action","gid","oid")); //初始化變量全局返回
//checklogin();//檢查登錄

checklogin();//檢查是否登錄

if(GetNum($gid)){
	include(INC_PATH."/group.class.php"); //包含團購類
	$gp=new GroupClass();
	//$value=$gp->getone($gid); 	//獲取團購信息
	$value = $gp->getOneGroup($gid);
	//判斷能否團購
	if($value[0]['group_state']==1 || $value[0]['group_state']==3 || $value[0]['group_end_time']< $timestamp)
	 showmessage("該團購已經結束","-1",false);
	 
	 
	 include(INC_PATH."/order.class.php");
	 $o=new OrderClass();
	 $userBuyCount=$o->getsum($_USERS['uname'],$gid);
}else  showmessage("缺少參數","-1",false);
//echo "refer:".$_SESSION['refer'];
//本頁基本設定
$this_page_name = "提交訂單";
include template('buy');//包含輸出指定模板
?>
